home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / PROGRAMM / DB_CLIPP / 2614.ZIP / TBROWSE.ZIP / TBROWSE_.TXT
Text File  |  1990-11-13  |  43KB  |  1,594 lines

  1. Overview
  2.  
  3. What Are TBROWSE Objects ?
  4.  
  5. TBROWSE objects are basically a collection of definitions. The
  6. definitions being:
  7.  
  8. 1. The size of the TBROWSE object
  9. 2. The number of columns (TBCOLUMN objects)
  10. 3. The colours for the columns (depending on their values)
  11. 4. Headings and footings for columns
  12. 5. Separators of Columns/Headings/Footings
  13. 6. How to move around the TBROWSE object, column to column and
  14. row to row.
  15.  
  16.  
  17.  
  18. TBROWSE objects are created using the class functions
  19. TBROWSENEW() and TBROWSEDB().
  20.  
  21.  
  22. TBROWSE objects are built up by specifying what are called
  23. Exported Instance Variables and manipulated using Exported
  24. Instance Methods.
  25.  
  26.  
  27. Exported Instance Variables are a means of referencing certain
  28. elements of the TBROWSE object. They have been given names such
  29. as nTop,nLeft,nBottom and nRight (the screen coordinates of the
  30. TBROWSE object) which make them more readable.
  31.  
  32. Exported Methods are a means of performing certain actions on a
  33. TBROWSE object. As with the instance variables the methods have
  34. meaningful names. The methods will act upon the values contained
  35. in the TBROWSE instance variables and the TBCOLUMN instance
  36. variables for each column in the TBROWSE object.
  37.  
  38.  
  39. The columns for TBROWSE objects are classed as TBCOLUMN objects
  40. which themselves have exported instance variables. These TBCOLUMN
  41. objects are added to the TBROWSE object. Each column being
  42. another set of rules for that particular column.
  43.  
  44.  
  45. What can TBROWSE Objects Be Used For ?
  46.  
  47. TBROWSE objects are one of the most powerful features added to
  48. Clipper 5.0. They enable browsing of data sets be they .DBF
  49. files, arrays, memory variables or directory information. Similar
  50. but more powerful than the functions DBEDIT() and ACHOICE().
  51.  
  52. TBROWSE objects offer the facility of being able to display any
  53. information in a table-type display with headings,footing and
  54. each column separated by any character, much the same as DBEDIT()
  55. but can DBEDIT() perform such things as Scoping data sets, moving
  56. columns, inserting new columns or even work on an array ? Not
  57. very easily. TBROWSE objects can.
  58.  
  59. Once mastered TBROWSE objects will become a regular part of every
  60. programmers applications.
  61.  
  62.  
  63. For the majority of this document you should assume that we are
  64. applying TBROWSE objects on .DBF files but keep an open mind. As
  65. you read you will instinctively think 'What ? You can do that ?
  66. Hang on...what if ...' You know what we mean.
  67.  
  68.  
  69.  
  70. Creating TBROWSE Objects
  71.  
  72. TBROWSE Classes
  73.  
  74. Class Functions
  75.  
  76. TBROWSE Class Function: TBROWSENEW()
  77.  
  78. Syntax:  TBROWSENEW( top , left , bottom , right )
  79.  
  80. Where: top,left,bottom,right are the screen coordinates in which
  81. the TBROWSE object is to be used in.
  82.  
  83. Purpose: TBROWSENEW() will create an empty TBROWSE object without
  84. containing any code blocks for the skipBlock,goBottomBlock and
  85. goTopBlock exported instance variables, (see TBROWSE exported
  86. instance variables for descriptions), or columns.
  87.  
  88. To create a TBROWSE object either the TBROWSENEW() or the
  89. TBROWSEDB() functions must be used.
  90.  
  91. To use this function the return value, the TBROWSE object, must
  92. be captured. For example:
  93.  
  94.  
  95. TBROWSENEW(10,10,20,60)
  96.  
  97. Will return a TBROWSE object but it cannot be used as it's return
  98. value has not be captured so you should use:
  99.  
  100. object_name := TBROWSENEW(10,10,20,60)
  101.  
  102.  
  103. This may seem obvious but you will be surprised how many people
  104. forget to do this.
  105.  
  106.  
  107. SEE ALSO: TBROWSEDB(), TBROWSE Exported Instance Variables
  108.  
  109.  
  110. TBROWSE Class Function: TBROWSEDB()
  111.  
  112. Syntax:  TBROWSEDB( top , left , bottom , right )
  113.  
  114. Where: top,left,bottom,right are the screen coordinates in which
  115. the TBROWSE object is to be used in.
  116.  
  117. Purpose: TBROWSEDB() will create an empty TBROWSE object
  118. containing default code blocks for the skipBlock,goBottomBlock
  119. and goTopBlock exported instance variables, (see TBROWSE exported
  120. instance variables for descriptions), but without any columns.
  121.  
  122. To create a TBROWSE object either the TBROWSEDB() or the
  123. TBROWSENEW() functions must be used.
  124.  
  125. To use this function the return value, the TBROWSE object, must
  126. be captured. For example:
  127.  
  128.  
  129. TBROWSEDB(10,10,20,60)
  130.  
  131. Will return a TBROWSE object but it cannot be used as it's return
  132. value has not be captured so you should use:
  133.  
  134. object_name := TBROWSEDB(10,10,20,60)
  135.  
  136.  
  137. This may seem obvious but you will be surprised how many people
  138. forget to do this.
  139.  
  140.  
  141. SEE ALSO: TBROWSENEW(), TBROWSE Exported Instance Variables
  142.  
  143.  
  144.  
  145. Assigning Instance Variables and Performing Exported Methods
  146.  
  147. When ever you wish to assign an instance variable or perform an
  148. exported method on an object the following syntax must be
  149. observed.
  150.  
  151. Assigning an instance variable
  152.  
  153. object name:instance variable := value
  154.  
  155.  
  156.  
  157. Performing an exported method
  158.  
  159. object name:method name(parameters)
  160.  
  161.  
  162. As long as these simple rules are used you can't go wrong.
  163.  
  164.  
  165.  
  166. Exported Instance Variables
  167.  
  168. TBROWSE Exported Instance Variable: autoLite
  169.  
  170. autoLite is a user assignable instance variable which must
  171. contain a logical value.
  172.  
  173. If the value of autoLite is .T. (true) the TBROWSE exported
  174. method stabilize() will automatically highlight the current cell
  175. of the TBROWSE object as part of the stabilization process. Which
  176. obviously means that if autoLite contains a value of .F. (false)
  177. highlighting of the current cell will not be performed. 
  178.  
  179. By default the value of autoLite is .T. .
  180.  
  181.  
  182.  
  183. Example
  184.  
  185. // Turn off auto highlighting
  186.  
  187. object:autoLite := .F.
  188.  
  189.  
  190. TBROWSE Exported Instance Variable: cargo
  191.  
  192. cargo is a user assignable instance variable that is provided as
  193. a user definable slot which may contain a value of any data type.
  194.  
  195. The information held in cargo will not be used by any of the
  196. TBROWSE exported methods so you must write the code to use it.
  197.  
  198. Implementing the cargo instance variable will give the TBROWSE
  199. object a great deal more power as it can be used to contain
  200. comments, help, a GET list or even another TBROWSE object.
  201.  
  202.  
  203. Example
  204.  
  205. // Assigning a character string to cargo
  206.  
  207. object:cargo := 'Hello World'
  208.  
  209.  
  210. TBROWSE Exported Instance Variable: colCount
  211.  
  212. colCount contains a numeric value being the total number of
  213. columns that have been added to the TBROWSE object using the
  214. exported method addColumn().
  215.  
  216. This instance variable is not assignable so don't try to.
  217.  
  218.  
  219. Example
  220.  
  221. // Retrieving the number of columns in a TBROWSE object
  222.  
  223.  
  224. Column_Count := object:colCount
  225.  
  226.  
  227. TBROWSE exported Instance Variable: colorSpec
  228.  
  229. colorSpec is a user assignable instance variable which contains a
  230. character string representing a colour table for the TBROWSE
  231. display. By default the value returned by SETCOLOR() will be
  232. used. This instance variable is also used as a lookup table later
  233. by the TBCOLUMN exported instance variables defColor and
  234. colorBlock.
  235.  
  236. The colour table string would be created like this:
  237.  
  238. color_string := 'W/N , N/W , GR+/B , R*/BG'
  239.                                     
  240. Table position 1 ─┘     │       │      └   Table position 4
  241.       Table position 2 ─┘       └─ Table position 3
  242.  
  243.  
  244. The colour string table can have as many colour combinations as
  245. required. Each colour specification must be separated by a comma.
  246.  
  247.  
  248. Example
  249.  
  250. // Assigning five colours combinations
  251.  
  252. object:colorSpec := { 'W/N' , 'N/W' , 'R/B' , 'B/R' , 'GR+/BG' }
  253.  
  254. // Index position       1       2       3       4         5
  255.  
  256.  
  257. TBROWSE Exported Instance Variable: colPos
  258.  
  259. colPos is a numeric user assignable instance variable used to set
  260. or retrieve the current column position of the TBROWSE object.
  261. Columns are number from 1 to x where 1 is the leftmost column.
  262.  
  263. If you set colPos to a different 'visible' column the cursor
  264. position will change. If you set colPos to a column that is not
  265. visible you must use the configure() exported method to force the
  266. refreshing of the display.
  267.  
  268.  
  269. Example
  270.  
  271. // Changing the column where the highlight bar is
  272.  
  273. object:colPos := 5    // Go to the 5th column
  274.  
  275. object:configure()    // Reconfigure everything incase column
  276.                       // is not on the screen
  277.  
  278.  
  279. TBROWSE Exported Instance Variable: colSep
  280.  
  281. colSep is a user assignable instance variable used to define the
  282. character(s) to be used by default to separate each column in the
  283. TBROWSE display.
  284.  
  285. The value set in colSep will be overridden if the colSep TBCOLUMN
  286. instance variable is specified.
  287.  
  288.  
  289. Example
  290.  
  291. // Assign ' ║ ' to be the default column separators
  292.  
  293. object:colSep := ' ║ '
  294.  
  295.  
  296. TBROWSE Exported Instance Variable: freeze
  297.  
  298. freeze is a user assignable instance variable containing a
  299. numeric value which specifies the number of data columns that are
  300. to be frozen from the leftmost column. Setting this instance
  301. variable will force the number of columns specified to be
  302. constantly displayed leaving other columns still being accessible
  303. by panning the display.
  304.  
  305. Note: If you specify a number high enough so that to disable
  306. other non-frozen columns never to be able to displayed by panning
  307. the display one or more of the frozen columns may not become
  308. frozen.
  309.  
  310.  
  311. Example
  312.  
  313. // Freeze the first three columns
  314.  
  315. object:freeze := 3
  316.  
  317.  
  318. TBROWSE Exported Instance Variable: goBottomBlock
  319.  
  320. goBottomBlock is a user assignable instance variable containing
  321. the code block to be evaluated whenever the goBottom() exported
  322. method is encountered.
  323.  
  324. When using the TBROWSEDB() class function to create the TBROWSE
  325. object the code block contained in goBottomBlock will call a user
  326. defined function that performs the GOTO BOTTOM command.
  327.  
  328. Note: If anything other than a code block is assigned to
  329. goBottomBlock an Internal Error 612 will occur.
  330.  
  331. Example
  332.  
  333. // Issuing a go bottom
  334.  
  335. object:goBottomBlock := {||MyGoBottom()}
  336.  
  337.  
  338. Function MyGoBottom()
  339.     GOTO BOTTOM
  340. Return NIL
  341.  
  342.  
  343. TBROWSE Exported Instance Variable: goTopBlock
  344.  
  345. goTopBlock is a user assignable instance variable containing the
  346. code block to be evaluated whenever the goTop() exported method
  347. is encountered.
  348.  
  349. When using the TBROWSEDB() class function to create the TBROWSE
  350. object the code block contained in goTopBlock will call a user
  351. defined function that performs the GOTO TOP command.
  352.  
  353. Note: If anything other than a code block is assigned to
  354. goTopBlock an Internal Error 612 will occur.
  355.  
  356.  
  357. Example
  358.  
  359. // Issuing a go top
  360.  
  361. object:goTopBlock := {||MyGoTop()}
  362.  
  363.  
  364. Function MyGoTop()
  365.     GOTO TOP
  366. Return NIL
  367.  
  368.  
  369. TBROWSE Exported Instance Variable: headSep
  370.  
  371. headSep is a user assignable instance variable used to define the
  372. character(s) to be used by default to separate each column for
  373. it's heading in the TBROWSE display.
  374.  
  375. The value set in headSep will be overridden if the headSep
  376. TBCOLUMN instance variable is specified.
  377.  
  378.  
  379. Example
  380.  
  381. // Assign '─╥─' to be the default header separators
  382.  
  383. object:headSep := '─╥─'
  384.  
  385.  
  386.  
  387. TBROWSE Exported Instance Variable: hitBottom
  388.  
  389. hitBottom is an user assignable instance variable containing a
  390. logical value. hitBottom will be set to .T. (true) if an attempt
  391. was made to navigate past the end of the available data otherwise
  392. it contains a .F. (false).
  393.  
  394. One of the biggest uses of hitBottom is the ability to trap for
  395. invalid records in scoped TBROWSEs.
  396.  
  397.  
  398. Note: Although hitBottom is assignable it's value may be changed
  399. by the stabilize() exported method.
  400.  
  401.  
  402. Example
  403.  
  404. // Beep if tried to move past the end of the scoped data
  405.  
  406. If object:hitBottom
  407.    ? Chr(7)
  408. Endif
  409.  
  410.  
  411. TBROWSE Exported Instance Variable: hitTop
  412.  
  413. hitTop is an user assignable instance variable containing a
  414. logical value. hitBottom will be set to .T. (true) if an attempt
  415. was made to navigate past the beginning of the available data
  416. otherwise it contains a .F. (false).
  417.  
  418. One of the biggest uses of hitTop is the ability to trap for
  419. invalid records in scoped TBROWSEs.
  420.  
  421.  
  422. Note: Although hitTop is assignable it's value may be changed by
  423. the stabilize() exported method.
  424.  
  425.  
  426. Example
  427.  
  428. // Beep if tried to move past the beginning of the scoped data
  429.  
  430. If object:hitTop
  431.    ? Chr(7)
  432. Endif
  433.  
  434.  
  435. TBROWSE Exported Instance Variables: nBottom,nLeft,nRight,nTop
  436.  
  437. nBottom, nLeft, nRight and nTop are all assignable instance
  438. variables containing numeric values for defining the row and
  439. column positions of the TBROWSE display.
  440.  
  441.  
  442. Examples
  443.  
  444. // Moving the TBROWSE screen up 5 rows and left 5 columns
  445.  
  446. object := TBROWSEDB(10,10,20,60)
  447.  
  448. object:nBottom := 15
  449. object:nLeft   := 5
  450. object:nRight  := 55
  451. object:nTop    := 5
  452.  
  453. object:configure()   // To redisplay everything correctly
  454.  
  455. // Same as doing object := TBROWSEDB(5,5,15,55)
  456.  
  457.  
  458. TBROWSE Exported Instance Variable: rowCount
  459.  
  460. rowCount contains a numeric value being the total number of
  461. visible rows.
  462.  
  463. This instance variable is not assignable so don't try to.
  464.  
  465.  
  466. Example
  467.  
  468. // Retrieving the number if visible data rows
  469.  
  470. data_rows := object:rowCount
  471.  
  472.  
  473. TBROWSE Exported Instance Variable: rowPos
  474.  
  475. rowPos is a numeric user assignable instance variable used to set
  476. or retrieve the current data row position of the TBROWSE object.
  477. Columns are number from 1 to x where 1 is the topmost data row.
  478.  
  479. Note: Screen rows, headings, footings or separators are not
  480. regarded as data rows.
  481.  
  482.  
  483. Example
  484.  
  485. // Move the highlight bar down 5 rows
  486.  
  487. object:rowPos ++5
  488.  
  489. SKIP 5                   // To retrieve the correct data
  490.  
  491. object:refreshCurrent()  // To display correct information
  492.  
  493.  
  494. TBROWSE Exported Instance Variable: skipBlock
  495.  
  496. skipBlock is a user assignable instance variable containing a
  497. code block to be evaluated whenever the up(), down(), pageUp(), 
  498. pageDown() TBROWSE cursor movement methods are encountered or
  499. during the stabilizing process using the stabilize() exported
  500. method.
  501.  
  502. The code block contained in skipBlock should receive one
  503. parameter, as it is always passed one. This parameter contains
  504. the number of rows to move, positive means in a downward
  505. direction and negative upward. The code block should then call a
  506. user defined function that passes this received parameter and any
  507. other you may wish to pass. For example a condition for a scope.
  508.  
  509. All checking of data scopes is then performed inside this user
  510. defined function and must return a numeric value in order for the
  511. TBROWSE object to function correctly. This return value should be
  512. the number of rows the skipBlock was able to actually move. If
  513. the return value equals the number of rows requested to move then
  514. both hitBottom and hitTop instance variables will be set to .F.
  515. (false). If not then either hitBottom or hitTop will be set to
  516. .T. (true) meaning that an attempt was made to move outside of
  517. the scoped data.
  518.  
  519. skipBlock is the most powerful exported instance variable in
  520. TBROWSE object. It should be used with care otherwise spurious
  521. results could and probably will occur.
  522.  
  523. Note: If a data type other than a code block is assigned to
  524. skipBlock an Internal Error 612 will occur.
  525.  
  526.  
  527. Examples
  528.  
  529. See the SKIPPER() Function in the TBDEMO.PRG in your
  530. \CLIPPER5\SOURCE\SAMPLE directory.
  531.  
  532.  
  533. TBROWSE Exported Instance Variable: stable
  534.  
  535. stable is a user assignable instance variable containing a
  536. logical value represent whether the TBROWSE is stable or not. A
  537. TBROWSE is considered stable when all data has been retrieved and
  538. displayed, the data source has been correctly re-positioned to
  539. the value at the browse cursor and the current cell has been
  540. highlighted (if required).
  541.  
  542. Note: If any Cursor Movement Method is used the stable instance
  543. variable is automatically set to .F. (false)
  544.  
  545.  
  546. Examples
  547.  
  548. // Check to see if the TBROWSE object is stable
  549.  
  550. Do While .T.
  551.    object:stabilize()
  552.    If object:stable
  553.       ? 'Object Stable'
  554.       Exit
  555.    Else
  556.       ? 'Object Not Stable'
  557.    Endif
  558. Enddo
  559.  
  560.  
  561. Exported Methods
  562.  
  563. Cursor Movement Methods
  564.  
  565. TBROWSE Cursor Movement Method: down()
  566.  
  567. down() forces a request to move down one row in the TBROWSE
  568. display. The code block contained in the skipBlock instance
  569. variable is then evaluated passing 1 as a parameter.
  570.  
  571. If moving down one row forces a request to move past the end of 
  572. the scope the hitBottom instance variable will then be set to .T.
  573. (true).
  574.  
  575.  
  576. Example
  577.  
  578. object:down()
  579.  
  580.  
  581.  
  582. TBROWSE Cursor Movement Method: end()
  583.  
  584.  
  585. end() forces the TBROWSE cursor to be displayed on the rightmost
  586. visible column. If the autoLite instance variable is set to .T.
  587. (true) the old column position will be automatically
  588. dehighlighted and the new column to be highlighted.
  589.  
  590.  
  591. Example
  592.  
  593. object:end()
  594.  
  595.  
  596. TBROWSE Cursor Movement Method: goBottom()
  597.  
  598. goBottom() forces evaluation of the code block contained in the
  599. goBottomBlock instance variable. Row positions will be updated to
  600. reflect this in the following way.
  601.  
  602. If the last scoped row is not visible or the last scoped record
  603. is displayed and is on the data row the row position (rowPos
  604. instance variable) will be set to the last data row position
  605. otherwise it will be set to the data row position where the last
  606. scoped data row is currently situated.
  607.  
  608. Example
  609.  
  610. object:goBottom()
  611.  
  612.  
  613. TBROWSE Cursor Movement Method: goTop()
  614.  
  615. goTop() forces evaluation of the code block contained in the
  616. goTopBlock instance variable. Row positions will be updated to 1.
  617.  
  618.  
  619. Example
  620.  
  621. object:goTop()
  622.  
  623.  
  624. TBROWSE Cursor Movement Method: home()
  625.  
  626.  
  627. home() forces the TBROWSE cursor to be displayed on the leftmost
  628. visible column. If the autoLite instance variable is set to .T.
  629. (true) the old column position will be automatically
  630. dehighlighted and the new column to be highlighted.
  631.  
  632.  
  633. Example
  634.  
  635. object:home()
  636.  
  637.  
  638. TBROWSE Cursor Movement Method: left()
  639.  
  640.  
  641. left() forces the TBROWSE cursor to be displayed on the column
  642. position one left of the current column position. If the autoLite
  643. instance variable is set to .T. (true) the old column position
  644. will be automatically dehighlighted and the new column to be
  645. highlighted. If the new column position is not visible the
  646. display is then panned to the left.
  647.  
  648.  
  649. Example
  650.  
  651. object:left()
  652.  
  653.  
  654. TBROWSE Cursor Movement Method: pageDown()
  655.  
  656. pageDown() forces a request to move the last visible data row in
  657. the TBROWSE display to the first. The code block contained in the
  658. skipBlock instance variable is then evaluated passing then number
  659. of visible data rows -1 as a parameter.
  660.  
  661. If moving up x number of rows forces a request to move past the
  662. end of  the scope the hitBottom instance variable will then be
  663. set to .T. (true).
  664.  
  665.  
  666. Example
  667.  
  668. object:pageDown()
  669.  
  670.  
  671. TBROWSE Cursor Movement Method: pageUp()
  672.  
  673. pageUp() forces a request to move the first visible data row in
  674. the TBROWSE display to the last. The code block contained in the
  675. skipBlock instance variable is then evaluated passing the -number
  676. of visible data rows -1 as a parameter.
  677.  
  678. If moving down x number of rows forces a request to move past the
  679. end of  the scope the hitBottom instance variable will then be
  680. set to .T. (true).
  681.  
  682.  
  683. Example
  684.  
  685. object:pageUp()
  686.  
  687.  
  688. TBROWSE Cursor Movement Method: panEnd()
  689.  
  690. panEnd() forces the current column position (colPos) to be set to
  691. the last available data column and displays that column as the
  692. rightmost column. Columns to the left of the last position are
  693. also drawn if necessary.
  694.  
  695.  
  696. Example
  697.  
  698. object:panEnd()
  699.  
  700.  
  701. TBROWSE Cursor Movement Method: panHome()
  702.  
  703. panHome() forces the current column position (colPos) to be set
  704. to the first available data column and displays that column as
  705. the leftmost column. Columns to the right of the last position
  706. are also drawn if necessary.
  707.  
  708.  
  709. Example
  710.  
  711. object:panHome()
  712.  
  713.  
  714. TBROWSE Cursor Movement Method: panLeft()
  715.  
  716. panLeft() will pan the display one or more positions to the left
  717. without changing the TBROWSE cursor position (if possible)
  718. causing the rightmost column (possibly more) to be removed from
  719. the display. 
  720.  
  721.  
  722. Example
  723.  
  724. object:panLeft()
  725.  
  726.  
  727. TBROWSE Cursor Movement Method: panRight()
  728.  
  729. panRight() will pan the display one or more positions to the
  730. right without changing the TBROWSE cursor position (if possible)
  731. causing the leftmost column (possibly more) to be removed from
  732. the display. 
  733.  
  734.  
  735. Example
  736.  
  737. object:panRight()
  738.  
  739.  
  740. TBROWSE Cursor Movement Method: right()
  741.  
  742.  
  743. right() forces the TBROWSE cursor to be displayed on the column
  744. position one right of the current column position. If the
  745. autoLite instance variable is set to .T. (true) the old column
  746. position will be automatically dehighlighted and the new column
  747. to be highlighted. If the new column position is not visible the
  748. display is then panned to the right.
  749.  
  750.  
  751. Example
  752.  
  753. object:right()
  754.  
  755.  
  756. TBROWSE Cursor Movement Method: up()
  757.  
  758. up() forces a request to move up one row in the TBROWSE display.
  759. The code block contained in the skipBlock instance variable is
  760. then evaluated passing -1 as a parameter.
  761.  
  762. If moving down one row forces a request to move past the
  763. beginning of the scope the hitTop instance variable will then be
  764. set to .T. (true).
  765.  
  766.  
  767. Example
  768.  
  769. object:up()
  770.  
  771.  
  772. Miscellaneous Methods
  773.  
  774. TBROWSE Miscellaneous Method: addColumn(column)
  775.  
  776. addColumn() add a new TBCOLUMN object previously created with the
  777. TBColumnNew() TBCOLUMN class function to a TBROWSE object.
  778.  
  779.  
  780. Example
  781.  
  782. // Add All Fields Of A .DBF into a TBROWSE Object
  783.  
  784. Select 1
  785. Use .DBF
  786.  
  787. object:=TBROWSEDB(10,10,20,60)
  788.  
  789. For i = 1 To FCOUNT()
  790.  
  791.    column := TBColumnNew(Fieldname(i),;
  792.                          FIELDWBLOCK(Fieldname(i),1))
  793.  
  794.    object:addColumn(column)
  795.  
  796. Next i
  797.  
  798.  
  799. TBROWSE Miscellaneous Method: colorRect(rectangle,colours)
  800.  
  801. colorRect() will cause the change of colour for a group of cells
  802. defined in the parameter <rectangle> to the colour combination
  803. specified in the parameter <colours>.
  804.  
  805. rectangle should be formatted in the following way:
  806.  
  807. { top data row ,;
  808.   leftmost data column ,;
  809.   bottom data row ,;
  810.   rightmost data column }
  811.  
  812. colours should be formatted in the following way:
  813.  
  814. { normal colour number , highlighted colour number }
  815.  
  816. The numbers specified in this array will correspond to positions
  817. in the colorSpec instance variable.
  818.  
  819.  
  820. Cells coloured using the colorRect() method visible or not, will
  821. matin these new colours until they are scrolled out of the
  822. TBROWSE object up and down only. Panning the TBROWSE display does
  823. not affect the colours.
  824.  
  825.  
  826. Example
  827.  
  828. // Colour for cells row 3 - col 5   to row 6 - col 10 in 
  829. // colour 3 and 4 of the colorSpec instance variable
  830.  
  831. object:colorSpec := { 'W/N' , 'N/W' , 'R/B' , 'B/R' }
  832.  
  833. object:colorRect( { 3 , 4 , 6 , 10 } , { 3 , 4 } )
  834.  
  835.  
  836. TBROWSE Miscellaneous Method: configure()
  837.  
  838. configure() causes the TBROWSE object to re-examine all of it's
  839. instance variables and TBCOLUMN objects. Depending on what it
  840. finds it will then reconfigure it's internal settings. The method
  841. would be used when one of the TBROWSEs' TBCOLUMN objects has been
  842. modified directly. ie/ when a column has been
  843. moved/inserted/deleted or had it's values changed.
  844.  
  845. Once this method has been changed a complete stablization will
  846. need to be done to redisplay the correct information.
  847.  
  848.  
  849. Example
  850.  
  851. // Change a columns width
  852. new_column := getColumn(3)
  853. newcolumn:width := 25
  854. object:setColumn(3,new_column)
  855.  
  856. // configure object after directly modifying a TBCOLUMN object
  857.  
  858. object:configure()
  859.  
  860.  
  861. TBROWSE Miscellaneous Method: deHilite()
  862.  
  863. deHilite() causes the current cell to be de-highlighted. If the
  864. cell is already de-highlighted this method will de-highlight it
  865. again.
  866.  
  867. deHilte() has been designed to be used when the autoLite instance
  868. variable is set to .F. (false).
  869.  
  870.  
  871. Example
  872.  
  873. object:deHilite()
  874.  
  875.  
  876. TBROWSE Miscellaneous Method: getColumn(column number)
  877.  
  878. getColumn() will return the TBCOLUMN object for the TBROWSE
  879. column specified in the parameter column number.
  880.  
  881.  
  882. This method is extremely useful. It would be used to enable any
  883. column to have it's value changed, be it it's colour, width,
  884. heading etc. To replace the TBCOLUMN object when it has been
  885. changed you would use the setColumn() method.
  886.  
  887. When used in conjunction with the setColumn() method it can be
  888. used to swap the positions of columns in a TBROWSE object.
  889.  
  890.  
  891. Example
  892.  
  893. // Change a columns width
  894. new_column := getColumn(3)
  895. newcolumn:width := 25
  896. object:setColumn(3,new_column)
  897.  
  898. // configure object after directly modifying a TBCOLUMN object
  899.  
  900. object:configure()
  901.  
  902.  
  903. TBROWSE Miscellaneous Method: hilite()
  904.  
  905. hilite() causes the current cell to be highlighted. If the cell
  906. is already highlighted this method will highlight it again.
  907.  
  908. hilite() has been designed to be used when the autoLite instance
  909. variable is set to .F. (false).
  910.  
  911.  
  912. Example
  913.  
  914. object:hiLite()
  915.  
  916.  
  917. TBROWSE Miscellaneous Method: refreshAll()
  918.  
  919. refreshAll() will cause all of the TBCOLUMN objects for a TBROWSE
  920. to be marked internally as invalid. This means the they need
  921. redisplaying. 
  922.  
  923. When the next stabilization occurs all columns will be redrawn.
  924.  
  925.  
  926. Example
  927.  
  928. // Refresh all columns
  929.  
  930. object:refreshAll()
  931.  
  932.  
  933. TBROWSE Miscellaneous Method: refreshCurrent()
  934.  
  935. refreshCurrent() will cause the current TBCOLUMN object for a
  936. TBROWSE to be marked internally as invalid. This means it needs
  937. to be redisplayed.
  938.  
  939. When the next stabilization occurs the column will be redrawn.
  940.  
  941.  
  942. Example
  943.  
  944. // Refresh Current Column
  945.  
  946. object:refreshCurrent()
  947.  
  948.  
  949. TBROWSE Miscellaneous Method:
  950. setColumn(column number,new column)
  951.  
  952. setColumn() will change the TBCOLUMN object for the TBROWSE
  953. column specified in the parameter column number with the new
  954. column contained in the parameter new column.
  955.  
  956. This method would be used to replace a TBCOLUMN object that has
  957. been changed directly after receiving it using the getColumn()
  958. method.
  959.  
  960. When used in conjunction with the getColumn() method it can be
  961. used to swap the positions of columns in a TBROWSE object.
  962.  
  963.  
  964.  
  965. Example
  966.  
  967. // Change a columns width
  968. new_column := getColumn(3)
  969. newcolumn:width := 25
  970. object:setColumn(3,new_column)
  971.  
  972. // configure object after directly modifying a TBCOLUMN object
  973.  
  974. object:configure()
  975.  
  976.  
  977. TBROWSE Miscellaneous Method: stabilize()
  978.  
  979. stabilize() will perform an incremental stabilization of the
  980. TBROWSE object. Each time this method is encountered a new part
  981. of the stablization process is done.
  982.  
  983. The actions performed by stablization are:
  984.  
  985. 1. Display of the TBROWSE object.
  986. 2. Display of each TBCOLUMN object visible or not.
  987. 3. Display of headings,footings,column/heading/footer separators.
  988. 4. Highlighting and dehighlighting of cells.
  989.  
  990. If the stablization has been successfully completed it will
  991. return a .T. (true) otherwise a .F. (false) will be returned
  992. indicating that there is still more to do.
  993.  
  994. Why would I want something that is not stable ?, I hear you ask.
  995. Depending on the complexity of the TBROWSE object some
  996. stabilizations may take longer than others. The stabilization has
  997. been designed to be performed in steps to enable the
  998. stabilization to be interrupted, by a keystroke for example.
  999. Although if you press a key, which interrupts stabilization,
  1000. process that key, which may mean alterations to the TBROWSE
  1001. object, the next time the stabilize() method is encountered it
  1002. will simply start stabilizing from the new values of the TBROWSE
  1003. object and it's TBCOLUMN objects.
  1004.  
  1005.  
  1006.  
  1007. Example
  1008.  
  1009. // Keep stabilizing until stable or a key has been pressed
  1010.  
  1011. Do While !(object:stabilize())
  1012.    nKey:=Inkey()
  1013.    If !(nKey = 0)
  1014.       Exit
  1015.    Endif
  1016. Enddo
  1017.       
  1018.  
  1019.  
  1020. TBCOLUMN Classes
  1021.  
  1022. Class Functions
  1023.  
  1024. TBCOLUMN Class Function: TBColumnNew(heading, retrieval block)
  1025.  
  1026. TBColumnNew() returns a TBCOLUMN object that can be added to a
  1027. TBROWSE object. The parameters heading and retrieval block must
  1028. be passed in order for this function to work.
  1029.  
  1030. heading is a character string containing the heading for the
  1031. TBCOLUMN object. The value of heading is placed into the heading
  1032. exported instance variable.
  1033.  
  1034. retrieval block is a code block the returns the data to be
  1035. displayed. The value of retrieval block is placed into the block
  1036. exported instance variable.
  1037.  
  1038. All other instance variables may be assigned to the TBCOLUMN
  1039. object once the object has been created using the syntax
  1040. described earlier.
  1041.  
  1042.  
  1043. Example
  1044.  
  1045. // Add All Fields Of A .DBF into a TBROWSE Object
  1046.  
  1047. Select 1
  1048. Use .DBF
  1049.  
  1050. object:=TBROWSEDB(10,10,20,60)
  1051.  
  1052. For i = 1 To FCOUNT()
  1053.  
  1054.    column := TBColumnNew(Fieldname(i),;
  1055.                          FIELDWBLOCK(Fieldname(i),1))
  1056.  
  1057.    object:addColumn(column)
  1058.  
  1059. Next i
  1060.  
  1061.  
  1062. Exported Instance Variables
  1063.  
  1064. TBCOLUMN Exported Instance Variable: block
  1065.  
  1066. block is a user assignable instance variable whose type must be a
  1067. code block. The value returned by that code block will determine
  1068. what the TBCOLUMN object will actually display.
  1069.  
  1070. Note: If a value other than a code block is assigned to block an
  1071. Internal error 612 will occur.
  1072.  
  1073.  
  1074. Example
  1075.  
  1076. // Assign a new field
  1077.  
  1078. object:block := FIELDWBLOCK( 'Fieldname' , 'Alias' )
  1079.  
  1080.  
  1081. TBCOLUMN Exported Instance Variable: cargo
  1082.  
  1083. cargo is a user assignable instance variable that is provided as
  1084. a user definable slot which may contain a value of any data type.
  1085.  
  1086. The information held in cargo will not be used by any of the
  1087. TBROWSE exported methods so you must write the code to use it.
  1088.  
  1089. Implementing the cargo instance variable will give the TBROWSE
  1090. object a great deal more power as it can be used to contain
  1091. comments, help, a GET list or even another TBROWSE object.
  1092.  
  1093.  
  1094. Example
  1095.  
  1096. // Assign a character string to cargo
  1097.  
  1098. object:cargo := 'Hello World'
  1099.  
  1100.  
  1101. TBCOLUMN Exported Instance Variable: colorBlock
  1102.  
  1103. colorBlock is an assignable instance variable of code block data
  1104. type. The code block assigned to colorBlock should receive one
  1105. parameter being the data retrieved by the block instance
  1106. variable. Depending on the value received by the code block an
  1107. array of two elements both containing numeric values must be
  1108. returned. The values contained in the returned array are colour
  1109. index numbers used as to pull the colours from the TBROWSE
  1110. colorSpec instance variable. 
  1111.  
  1112. Note: If colorBlock is specified it will override the value
  1113. contained in the defColor instance variable.
  1114.  
  1115. Example
  1116.  
  1117. // Give different colours for negative numbers
  1118.  
  1119. object:colorBlock := { |arg| If(arg < 0 ,{ 3 , 4 } ,{ 1 ,2 } ) }
  1120.  
  1121.  
  1122. TBCOLUMN Exported Instance Variable: colSep
  1123.  
  1124. colSep is a user assignable instance variable used to define the
  1125. character(s) to be used to separate the column TBCOLUMN object
  1126. from the next in the display.
  1127.  
  1128. The value set in colSep will override the value in the TBROWSE
  1129. colSep instance variable.
  1130.  
  1131.  
  1132. Example
  1133.  
  1134. object:colSep := ' ║ '
  1135.  
  1136.  
  1137. TBCOLUMN Exported Instance Variable: defColor
  1138.  
  1139. defColor is an assignable instance variable with a data type of
  1140. array containing two element being the colour index numbers of
  1141. the TBROWSE colorSpec instance variable. By default { 1 , 2 } is
  1142. assigned to defColor. The first color index number is the normal
  1143. colour, the second being the highlighted colour.
  1144.  
  1145. Note: If colour index number held in defColor will be overridden
  1146. if the colorBlock instance variable has been defined.
  1147.  
  1148.  
  1149. Example
  1150.  
  1151. // Use colours 1 and 2 for character otherwise use 3 and 4
  1152.  
  1153. If VALTYPE( EVAL( object:block ) ) = 'C'
  1154.  
  1155.    object:defColor := { 1 , 2 }
  1156.  
  1157. Else
  1158.   
  1159.    object:defColor := { 3 , 4 }
  1160.  
  1161. Endif
  1162.  
  1163.  
  1164. TBCOLUMN Exported Instance Variable: footing
  1165.  
  1166. footing is an assignable instance variable which when assigned
  1167. determines what to display as a footing for a TBCOLUMN object.
  1168. The footing will be displayed on the bottom row of the TBROWSE
  1169. object window. Specifying this instance variable will cause the
  1170. loss of one data row.
  1171.  
  1172.  
  1173. Example
  1174.  
  1175. object:footing := 'This is a footing'
  1176.  
  1177.  
  1178. TBCOLUMN Exported Instance Variable: footSep
  1179.  
  1180. footSep is an assignable instance variable containing the
  1181. character(s) to separate the footing instance variable from the
  1182. bottom data row. Specifying this instance variable will cause the
  1183. loss of one more data row.
  1184.  
  1185.  
  1186. Example
  1187.  
  1188. object:footSep := '─╨─'
  1189.  
  1190.  
  1191. TBCOLUMN Exported Instance Variable: heading
  1192.  
  1193. heading is an assignable instance variable which when assigned
  1194. determines what to display as a heading for a TBCOLUMN object.
  1195. The footing will be displayed on the top row of the TBROWSE
  1196. object window. Specifying this instance variable will cause the
  1197. loss of one data row. 
  1198.  
  1199. The initial value assigned to this instance variable will be the
  1200. value passed as a heading to the TBColumnNew() class function.
  1201.  
  1202.  
  1203. Example
  1204.  
  1205. object:heading := 'This is a heading'
  1206.  
  1207.  
  1208. TBCOLUMN Exported Instance Variable: headSep
  1209.  
  1210. headSep is a user assignable instance variable used to define the
  1211. character(s) to be used by to separate each column for it's
  1212. heading in the TBROWSE display.
  1213.  
  1214. The value set in headSep will override the TBROWSE headSep
  1215. instance variable.
  1216.  
  1217.  
  1218. Example
  1219.  
  1220. object:headSep := '─╥─'
  1221.  
  1222.  
  1223. TBCOLUMN Exported Instance Variable: width
  1224.  
  1225. width is a user assignable instance variable of numeric type to
  1226. determine the width of the TBCOLUMN object.
  1227.  
  1228. If the value contained in width is greater than the number of
  1229. screen column available to the TBROWSE object the width instance
  1230. variable will stay at the assigned variable but the display will
  1231. only show the maximum width allowed by the TBROWSE object.
  1232.  
  1233. Note: If it's value is greater than the length of the value
  1234. returned by the block instance variable the width of the
  1235. highlight bar will not be increased. To do this the block
  1236. instance variable must be modified.
  1237.  
  1238.  
  1239. Example
  1240.  
  1241. object:width := 25
  1242.  
  1243.  
  1244. Power Of TBROWSE Objects
  1245.  
  1246. Scoping TBROWSE objects
  1247.  
  1248. The main problem of DBEDIT() in Clipper Summer 87 is that is was
  1249. difficult to browse a subset of a .DBF file. A lot of code was
  1250. needed to perform this task but with TBROWSE objects it has been
  1251. made a great deal easier. The handling of TBROWSE objects is user
  1252. definable, you tell the TBROWSE object what you want to display
  1253.  
  1254. There are several ways of creating scoped TBROWSE objects, some
  1255. more easier than others.
  1256.  
  1257. Described below are three ways to achieve this.
  1258.  
  1259.  
  1260. Method 1
  1261.  
  1262. Using the SET FILTER TO command.
  1263.  
  1264. Using the SET FILTER TO command is the easiest way of creating
  1265. scoped TBROWSE objects. Simply set a filter to a condition and
  1266. perform the most simple TBROWSE handling routine ie/ one that
  1267. moves the cursor position and allows editing letting the SET
  1268. FILTER command handle which records are to be displayed.
  1269.  
  1270. ADVANTAGES
  1271.  
  1272. 1. Easy to create
  1273. 2. No Indexes Required
  1274.  
  1275. DISADVANTAGES
  1276.  
  1277. 1. Very slow when cursoring out of the scope, especially on large
  1278. .DBF files
  1279.  
  1280.  
  1281.  
  1282. Method 2
  1283.  
  1284. Coding the scope into the user defined function contained in the
  1285. code block for the skipBlock, goBottomBlock and goTopBlock
  1286. instance variables.
  1287.  
  1288. Using this method will require a deeper knowledge of the way
  1289. TBROWSE objects work internally. To make the most of this method
  1290. an index should be used. For example: If you want a list of
  1291. transactions for a particular customer, the transactions file
  1292. would have an index built on the customer id.
  1293.  
  1294. ADVANTAGES
  1295.  
  1296. 1. Quick when cursoring out of the scope as using an index will
  1297. keep the records in a scoped order.
  1298.  
  1299. DISADVANTAGES
  1300.  
  1301. 1. A different user defined function will be needed for each 
  1302. different scope.
  1303.  
  1304.  
  1305. Example
  1306.  
  1307. // Modification of default skipBlock
  1308.  
  1309. object:skipBlock := {|x|Skipper(x,lAppend)}
  1310.  
  1311.  
  1312. Function Skipper(n,lAppend)
  1313.  
  1314. local i
  1315.  
  1316.    i := 0
  1317.    If ( LastRec() != 0 )
  1318.       If ( n == 0 )
  1319.          SKIP 0
  1320.       Elseif ( n > 0 .and. Recno() != LastRec() + 1 )
  1321.          Do While ( i < n )
  1322.             SKIP 1
  1323.             If ( Eof() .or. !(condition))
  1324.                If ( lAppend )
  1325.                   i++
  1326.                Else
  1327.                   SKIP -1
  1328.                Endif
  1329.                Exit
  1330.             Endif
  1331.             i++
  1332.          Enddo
  1333.       Elseif ( n < 0 )
  1334.          Do While ( i > n )
  1335.             SKIP -1
  1336.             If ( Bof() .or. !(condition))
  1337.                exit
  1338.             Endif
  1339.             i--
  1340.          Enddo
  1341.       Endif
  1342.    Endif
  1343.  
  1344. return (i)
  1345.  
  1346.  
  1347. Where (condition) would be something like:
  1348.       CUST_ID == CUSTOMER->CUST_ID
  1349. or
  1350.  
  1351. (condition) could be a variable which could be macroed.
  1352.  
  1353. goTopBlock would simply perform a SEEK to find the first scoped
  1354. record.
  1355.  
  1356. goBottomBlock would keep SKIPing until it finds the last scoped
  1357. record. The best way to do this is to skip in blocks of ten (or
  1358. more) until you are out of the scope then SKIP backwards.
  1359.  
  1360.  
  1361.  
  1362. Method 3
  1363.  
  1364. Coding the scope into the user defined function contained in the
  1365. code block for the skipBlock, goBottomBlock and goTopBlock
  1366. passing a code block to the user defined function assigned in the
  1367. code blocks for skipBlock,goTopBlock and goBottomBlock.
  1368.  
  1369. Using this method will require a deep knowledge of the way
  1370. TBROWSE objects work internally as well as a good knowledge of
  1371. code blocks and their power. To make the most of this method an
  1372. index should be used. For example: If you want a list of
  1373. transactions for a particular customer, the transactions file
  1374. would have an index built on the customer id.
  1375.  
  1376. The best way to implement this method is by using the TBROWSE
  1377. cargo instance variable.
  1378.  
  1379. ADVANTAGES
  1380.  
  1381. 1. Quick when cursoring out of the scope as using an index will
  1382. keep the records in a scoped order.
  1383. 2. Code blocks are faster than macros (and more powerful).
  1384. 3. Only ONE user defined function will be required for
  1385. skipBlock,goBottomBlock and goTopBlock.
  1386. 4. Once working the user defined function will never need
  1387. changing.
  1388. 5. The scope can be changed at any time without any code changes.
  1389.  
  1390. DISADVANTAGES
  1391.  
  1392. 1. Not very easy to get right first time.
  1393.  
  1394. Example
  1395.  
  1396. // Modification of default skipBlock
  1397.  
  1398. object:cargo := {||CUST_ID == CUSTOMER->CUST_ID}
  1399. object:skipBlock := {|x|Skipper(x,lAppend,object:cargo)}
  1400.  
  1401.  
  1402. Function Skipper(n,lAppend,condition_block)
  1403.  
  1404. local i
  1405.  
  1406.    i := 0
  1407.    If ( LastRec() != 0 )
  1408.       If ( n == 0 )
  1409.          SKIP 0
  1410.       Elseif ( n > 0 .and. Recno() != LastRec() + 1 )
  1411.          Do While ( i < n )
  1412.             SKIP 1
  1413.             If ( Eof() .or. !EVAL(condition_block))
  1414.                If ( lAppend )
  1415.                   i++
  1416.                Else
  1417.                   SKIP -1
  1418.                Endif
  1419.                Exit
  1420.             Endif
  1421.             i++
  1422.          Enddo
  1423.       Elseif ( n < 0 )
  1424.          Do While ( i > n )
  1425.             SKIP -1
  1426.             If ( Bof() .or. !EVAL(condition_block))
  1427.                exit
  1428.             Endif
  1429.             i--
  1430.          Enddo
  1431.       Endif
  1432.    Endif
  1433.  
  1434. return (i)
  1435.  
  1436.  
  1437.  
  1438.  
  1439. There are of course more ways of implementing scoped TBROWSE
  1440. objects using macros,code blocks in various ways.
  1441.  
  1442. Note: The more code blocks that are used over macros the faster
  1443. the TBROWSE will run.
  1444.  
  1445.  
  1446.  
  1447. Array TBROWSE Objects
  1448.  
  1449. Many Clipper users look upon TBROWSE objects as being a mechanism
  1450. of browsing .DBF files and only .DBF files. This is not the case.
  1451. TBROWSE objects can be used on elements of an array similar to
  1452. the way the ACHOICE() function works but with more power.
  1453.  
  1454. To use TBROWSE objects on arrays the code blocks contained in the
  1455. skipBlock,goBottomBlock and goTopBlock instance variables must be
  1456. modified drastically to handle the display and update of the
  1457. array elements.
  1458.  
  1459. A great deal more power can be creating multi-dimensional arrays
  1460. to handle comments,actions to be performed upon certain keys and
  1461. much more.
  1462.  
  1463. Example
  1464.  
  1465. // Array to browse
  1466. array := {'ELEMENT 1','ELEMENT 2','ELEMENT 3','ELEMENT 4'}
  1467. current_element := 1
  1468.  
  1469. object:=TBROWSENEW(10,10,15,25)
  1470.  
  1471. code_block := {|setval|IF(setval==NIL,array[current_element],;
  1472.                array[current_element] := setval)}
  1473.    
  1474. column := TBCOLUMNNEW('Arrays',code_block)
  1475.  
  1476. object:addColumn(column)
  1477.  
  1478.  
  1479. object:skipBlock := {|x|ArraySkip(x)}
  1480. object:goTopBlock := {||ATopBottom(1)}
  1481. object:goBottomBlock := {||ATopBottom(Len(Array))}
  1482.  
  1483.  
  1484. Function ArraySkip(n)
  1485.  
  1486. Local i:=0
  1487.  
  1488. If n > 0
  1489.    Do While n > 0
  1490.       If current_element +1 <= Len(array)
  1491.          current_element ++
  1492.          i ++
  1493.          n --
  1494.       Else
  1495.          Exit
  1496.       Endif
  1497.    Enddo
  1498. Elseif n < 0
  1499.    Do While n < 0
  1500.       If current_element -1 >= 1
  1501.          current_element --
  1502.          i --
  1503.          n ++
  1504.       Else 
  1505.          Exit
  1506.       Endif
  1507.    Enddo
  1508. Endif
  1509.  
  1510. Return i
  1511.  
  1512.  
  1513. Function Atopbottom(x)
  1514.  
  1515. current_element := x
  1516.  
  1517. Return NIL
  1518.  
  1519.  
  1520. One of the advantages of using TBROWSE objects on arrays over the
  1521. ACHOICE() function is that each element of the array can be modified
  1522. directly.
  1523.  
  1524.  
  1525.  
  1526. Column Modifications
  1527.  
  1528. The ability to be able to make modifications to a TBCOLUMN object
  1529. directly give TBROWSE object a great deal more power than any
  1530. function in Clipper.
  1531.  
  1532. For example, if you wanted to change the information displayed in
  1533. a field using DBEDIT() you must exit the DBEDIT() then re-enter
  1534. it. This causes the cursor positions to change. With TBROWSE
  1535. objects this does not occur as the columns can be modified
  1536. directly. If you change the information to be displayed you
  1537. simply issue the reFreshCurrent() exported method and everything
  1538. is taken care of.
  1539.  
  1540. The same with ACHOICE(). Although with ACHOICE() you can set the
  1541. starting positions you still have to exit the ACHOICE() and
  1542. re-enter it.
  1543.  
  1544.  
  1545.  
  1546. Column Insertion
  1547.  
  1548. How many times have users of your applications wanted to be able
  1549. to display more information than you have provided but only at
  1550. certain times ? Quite often. This is no problem with TBROWSE
  1551. objects. Simply create a new TBCOLUMN class and use the
  1552. addColumn() exported method to add it to the TBROWSE object.
  1553.  
  1554.  
  1555.  
  1556. Column Movement
  1557.  
  1558. Wouldn't it be nice to be able to change the order of the columns
  1559. in a browse display. With TBROWSE objects this is simple, as long
  1560. as these rules are stuck to.
  1561.  
  1562. 1. Take a copy of the column you want to move using the
  1563. getColumn() exported method.
  1564.  
  1565. 2. Copy the column left or right of the column you want to move
  1566. depending on the direction you wish to move the column also using
  1567. setColumn() to the position of the column you wish to move.
  1568.  
  1569. 3. Copy the copy of the column you wish to move into the position
  1570. you wish to move it to using the setColumn() exported method.
  1571.  
  1572. 4. Use the configure() exported method to force the screen to be
  1573. refreshed during the next stabilization process.
  1574.  
  1575.  
  1576. Use this style and you can't go wrong.
  1577.  
  1578. You could also write a user defined command to do this.
  1579.  
  1580. Example
  1581.  
  1582. #command MOVE COLUMN n LEFT => ;
  1583. ;
  1584. old_column := object:getColumn(n) ;;
  1585. object:setColumn(n,object:getColumn(n-1)) ;;
  1586. object:setColumn(n-1,old_column)
  1587.  
  1588.  
  1589.  
  1590. Examples
  1591.  
  1592. REAL examples are being worked on at this moment in time. Keep
  1593. you posted.
  1594.